package com.shenganyuan.smac.contact.presenter;

import com.oklib.utils.Logger.Logger;
import com.oklib.utils.helper.RxUtil;
import com.oklib.utils.network.http.callback.ACallback;
import com.oklib.utils.network.http.subscriber.ApiCallbackSubscriber;
import com.shenganyuan.smac.contact.contract.ContactContract;
import com.shenganyuan.smac.contact.model.ApiMainContact;


/**
 * Created by Damon.Han on 2018/3/30 0030.
 *
 * @author Damon
 */
public class ContactPresenter extends ContactContract.ABSContactPresenter {
    @Override
    public void onStart() {
        Logger.e("onStart");
    }

    @Override
    public void getContacts() {
        mModel.getContacts().compose(RxUtil.rxSchedulerHelper()).subscribe(new ApiCallbackSubscriber<ApiMainContact>(new ACallback<ApiMainContact>() {
            @Override
            public void onSuccess(ApiMainContact data) {
                mView.showContent(data);
            }

            @Override
            public void onFail(int errCode, String errMsg) {
                mView.showMsg(errMsg);
            }
        }));
    }
}
